package zjc.bookkeeping.adapter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import zjc.bookkeeping.R;

public class ConsumptionNameAdapter extends BaseAdapter {
    Context context;
    List<String> consumptionNameList;

    public ConsumptionNameAdapter(Context context, List<String> consumptionNameList) {
        this.context = context;
        this.consumptionNameList = consumptionNameList;
    }

    @Override
    public int getCount() {
        return consumptionNameList.size();
    }

    @Override
    public Object getItem(int i) {
        return consumptionNameList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(context).inflate(R.layout.dialog_select_class_item,viewGroup,false);
        TextView textView = view.findViewById(R.id.dialog_select_class_item_tv);
        String consumptionName = consumptionNameList.get(i);
        textView.setText(consumptionName);
        return view;
    }
}
